package com.youchuang.action.indent;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.youchuang.action.BaseAction;
import com.youchuang.bean.User;
import com.youchuang.common.Constant;
import com.youchuang.service.IndentService;

/**
 * 提交订单的支付方式
 * 
 * @author Administrator
 *
 */
@Namespace(value = "/indent")
@ParentPackage("shopping-default")
public class IndentPayfirstAction extends BaseAction {
	private Logger logger = Logger.getLogger(IndentPayfirstAction.class.getSimpleName());
	private String bankRadio;
	private String IndentId;
	private String passWord;
	
	@Resource
	private IndentService indentService;

	@Action(value = "indentPayFirst", interceptorRefs = { @InterceptorRef(value = "loginStack") }, results = {
			@Result(name = Constant.SUCCESS, location = "/WEB-INF/jsp/indent/indent_ok.jsp") })
	public String execute() {
		logger.info("excetion is execute");
		User user = (User) session.get(Constant.S_USER);
		if (user == null || passWord == null)
			return Constant.ERROR;

		String pass = user.getPassword();
		String result = indentService.indentPayVerify(IndentId, bankRadio, passWord, pass);
		return result;
	}

	public String getBankRadio() {
		return bankRadio;
	}

	public void setBankRadio(String bankRadio) {
		this.bankRadio = bankRadio;
	}

	public String getIndentId() {
		return IndentId;
	}

	public void setIndentId(String indentId) {
		IndentId = indentId;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

}
